package apiday02homework;

import java.util.ArrayList;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        ArrayList<String> list = new ArrayList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");
        for (int i : arr) {
            System.out.println(i);
        }
        for (String l : list) {
            System.out.println(l);
        }
        // 迭代器实现遍历集合元素
        Iterator<String> it = list.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
    }
}
